mi bot no está creando un canal de tickets cuando un usuario está reaccionando al emoji, el bot solo está creando un canal de tickets cuando le doy derechos de administrador a mi bot dentro del propio rol de Discord.
¿Qué podría estar mal en mi código cuando el usuario reacciona al emoji? ¿Falta algo o faltan permisos a continuación? ID de mis bots 701327880046510080
Y por cierto. en mi discordia, le he dado a mi bot todos los derechos, pero no los derechos de administrador en la parte inferior de los permisos de roles.
¡Cualquier ayuda sería apreciada!
if(reaction.message.id == ticketid && reaction.emoji.name == '🎫') { reaction.users.remove(user); const ticketChannel = reaction.message.guild.channels.cache.find(chan => chan.name === `ticket-${user.username}`) if (ticketChannel) return; reaction.message.guild.channels.create(`ticket-${user.username}`, { parent: '701254271861260389', position: 1, permissionOverwrites: [ { id: '701327880046510080', allow: ["MANAGE_CHANNELS", "MANAGE_GUILD", "MANAGE_ROLES", "MANAGE_EMOJIS", "READ_MESSAGE_HISTORY", "MANAGE_MESSAGES", "SEND_MESSAGES", "VIEW_CHANNEL"] }, { id: user.id, allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"] }, { id: reaction.message.guild.roles.everyone, deny: ["VIEW_CHANNEL"] }, { id: '306893721725829121', allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"] } ],Definitivamente es un problema de permisos, ya que dijiste que solo funciona cuando le das al administrador del bot. También podría deberse al fragmento a continuación, está otorgando el permiso pero luego se lo niega a todos.
{ id: reaction.message.guild.roles.everyone, deny: ["VIEW_CHANNEL"] },Intente esto y avíseme si / qué errores obtiene con la await . Deberá asegurarse de que su oyente sea async , por lo que es posible que deba agregarse al código anterior, que según la otra pregunta debería ser.
if (reaction.message.id == ticketid && reaction.emoji.name == '🎫') { reaction.users.remove(user); const channelName = `ticket-${user.username}`; const ticketChannel = reaction.message.guild.channels.cache.find(chan => chan.name === channelName); if (ticketChannel) return; const newChannel = await reaction.message.guild.channels.create(channelName, { parent: '701254271861260389', position: 1, permissionOverwrites: [{ id: reaction.message.guild.id, deny: ["VIEW_CHANNEL"], }, { id: user, allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"], }, { id: '306893721725829121', allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"], }, { id: '701327880046510080', allow: ["MANAGE_CHANNELS", "MANAGE_GUILD", "MANAGE_ROLES", "MANAGE_EMOJIS", "READ_MESSAGE_HISTORY", "MANAGE_MESSAGES", "SEND_MESSAGES", "VIEW_CHANNEL"] }], }).catch((error) => { console.log(error) }); console.log(newChannel); }Si lo anterior falla, es probable que se trate de un problema de permisos, solo necesita averiguar con certeza qué lo impide.